package com.itheima.demo.demo10;
//从键盘录入一行字符串，利用字节打印流将该行字符串保存到当前项目根目录下的d.txt文件中
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Scanner;

public class Test_4 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in=new Scanner(System.in);
        System.out.println("请输入字符串：");
        String s = in.next();
       PrintStream ps=new PrintStream("D:\\d.txt");
       System.setOut(ps);
        System.out.println(s);
    }
}
